package com.lzy.gmall.realtime.app.dwd;

import com.lzy.gmall.realtime.utils.MyKafkaUtil;
import com.lzy.gmall.realtime.utils.MysqlUtil;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

import java.time.Duration;

public class Dwd_Transaction_field_order_details_Pair_Table {
    public static void main(String[] args) throws Exception {
        //TODO 1.获取执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        1. 创建执行环境并设置并行度
        env.setParallelism(1);

//        2. 创建表环境并配置状态
        StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env);
//        3.当某个 key 的数据超过 5 秒没有更新时，Flink 会自动清理该 key 的状态，释放内存资源
//        tableEnv.getConfig().setIdleStateRetention(Duration.ofSeconds(5));
//        4. 注册 Kafka 数据源表
        tableEnv.executeSql(MyKafkaUtil.getTopicDb("order_pre_process_211127"));

//        5.创建表格添加字段






        env.execute();
    }
}